package io.renren.modules.task.service;

import io.renren.common.utils.R;
import io.renren.datasource.annotation.DataSource;
import io.renren.modules.task.entity.TestEntity;
import io.renren.modules.task.entity.TestEntity2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: 蔡翔
 * @Date: 2019/9/27 11:03
 * @Version 1.0
 */
public class SqlServerService {
    @Autowired
    private TestService testService;

    @DataSource("slave1")
    public List<TestEntity2> multiDatasource(){
        Map<String,Object> queryMapper = new HashMap<>();
        queryMapper.put("user_name","cx");
        List<TestEntity2> testEntity = testService.getBaseMapper().selectByMap(queryMapper);
        return testEntity;
    }
}